package e.odbo.data.service.base.impl;

import com.openbravo.data.basic.BasicException;
import e.odbo.data.bean.IKeyed;
import e.odbo.data.bean.I_BaseBean;
import e.odbo.data.dao.BaseDAO;
import e.odbo.data.dsl.query.QBFParameters;
import e.odbo.data.service.base.I_BaseBeanService;

import java.util.List;

public class BaseBeanServiceWarp<T extends I_BaseBean> extends ViewBeanServiceWarp<T> implements I_BaseBeanService<T> {

    BaseDAO<T> baseDAO;

    public BaseBeanServiceWarp(BaseDAO<T> baseDAO) {
        super(baseDAO);
        this.baseDAO = baseDAO;
    }

    @Override
    public boolean exist(IKeyed id) throws BasicException {
        return baseDAO.exist(id);
    }

    @Override
    public int update(T t) throws BasicException {
        return baseDAO.update(t);
    }

    @Override
    public int delete(IKeyed t) throws BasicException {
        return baseDAO.delete(t);
    }

    @Override
    public int insert(T t) throws BasicException {
        return baseDAO.insert(t);
    }

    @Override
    public int delete(List<IKeyed> objs) throws BasicException {
        return baseDAO.delete(objs);
    }

    @Override
    public int update(List<T> objs) throws BasicException {
        return update(objs);
    }

    @Override
    public int insert(List<T> objs) throws BasicException {
        return baseDAO.insert(objs);
    }

    @Override
    public int insertOrUpdate(T t) throws BasicException {
        return baseDAO.insertOrUpdate(t);
    }

    @Override
    public int insertOrUpdate(List<T> objs) throws BasicException {
        return baseDAO.insertOrUpdate(objs);
    }

    @Override
    public int clear() throws BasicException {
        return baseDAO.clear();
    }

    @Override
    public boolean canUpdate() {
        return baseDAO.canUpdate();
    }

    @Override
    public boolean canInsert() {
        return baseDAO.canInsert();
    }

    @Override
    public boolean canDelete() {
        return baseDAO.canDelete();
    }

    @Override
    public int updateByField(IKeyed key, String field, Object newValue) throws BasicException {
        return baseDAO.updateByField(key,field,newValue);
    }

    @Override
    public int updateByFields(IKeyed key, String[] fields, Object[] newValue) throws BasicException {
        return baseDAO.updateByFields(key,fields,newValue);
    }

    @Override
    public int delete(QBFParameters filter) throws BasicException {
        return baseDAO.delete(filter);
    }

    @Override
    public boolean isExistByField(String field, Object value) throws BasicException {
        return baseDAO.isExistByField(field,value);
    }

    @Override
    public boolean isExistByFields(String[] fields, Object[] values) throws BasicException {
        return baseDAO.isExistByFields(fields,values);
    }

    @Override
    public boolean isExist(QBFParameters filter) throws BasicException {
        return baseDAO.isExist(filter);
    }

    @Override
    public T find(IKeyed id) throws BasicException {
        return baseDAO.find(id);
    }

    @Override
    public T find(QBFParameters filter) throws BasicException {
        return baseDAO.find(filter);
    }
}
